{include file="public/header" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <select name="type">
                                <option value="">排行类型</option>
                                <option value="1" {if !empty(input('get.type')) && input('get.type')==1}selected{/if}>
                                    总营业额排行
                                </option>
                                <option value="2" {if !empty(input('get.type')) && input('get.type')==2}selected{/if}>
                                    今日营业额排行
                                </option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">搜索</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    共有数据：<strong id="count">{$list->total()}</strong> 条
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>商家</th>
                                <th>商家账号</th>
                                <th>系统备注</th>
                                <th>商户余额</th>
                                <th>配送范围</th>
                                <th>起送价</th>
                                <th>商家位置</th>
                                <th>状态</th>
                                <th>累计营业额</th>
                                <th>今日营业额</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td>{$v.id|default=''}</td>
                                <td>{$v.title|default=''}</td>
                                <td>{$v.account|default=''}</td>
                                <td>{$v.remark|default='无'}</td>
                                <td>
                                    <a title="查看记录" onclick="data_edit('操作','/shop/shoplog?shopid={$v.id}')"
                                        href="javascript:;" class="layui-btn layui-btn-normal">
                                        {$v.money|default='0'}元
                                    </a>
                                </td>
                                <td>{$v.ranges|default='0'}KM</td>
                                <td>{$v.startsend|default='0'}元</td>
                                <td>
                                    <a title="查看位置"
                                        onclick="data_edit('查看位置','https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx={$v.lon}&pointy={$v.lat}&name={$v.title}&addr=&ref=myapp')"
                                        href="javascript:;" class="layui-btn layui-btn-normal">
                                        查看位置
                                    </a>
                                </td>
                                <td>
                                    {if !empty($v.status) && $v.status == 1}正常{else/}禁用{/if}
                                </td>
                                <td>{$v.total|default='0'}元</td>
                                <td>{$v.todaytotal|default='0'}元</td>
                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {$list->render()|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script>
    function money_edit(title, url, id) {
        layer.prompt({
            formType: 0,
            value: 0,
            title: title,
        }, function (value, index, elem) {
            $.ajax({
                type: 'post',
                url: url,
                data: { id: id, money: value },
                success: function (res) {
                    if (res.code == 0) {
                        layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                            layer.close(index);
                            // 获得frame索引
                            location.reload();
                        });
                    } else {
                        layer.msg(res.msg, { icon: 2, time: 1000 });
                    }
                }
            });
            return false;

        });
    }
    layui.use(['form', 'upload'], function () {
        var $ = layui.jquery
            , form = layui.form
            , layer = layui.layer;
    });
</script>
<script>
    layer.photos({
        photos: '#layer-photos'
        , anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
    });
</script>
{include file="public/footer"}